//
//  SEGSharedFowardModel.m
//  ExcellentHome
//
//  Created by 揭婧雯 on 2017/10/23.
//  Copyright © 2017年 陈区. All rights reserved.
//

#import "SEGSharedFowardModel.h"
#import "SEGUtils.h"
#if __has_include(<Commom/SEGLayoutMacro.h>)
#import <Commom/SEGLayoutMacro.h>
#else
#import "SEGLayoutMacro.h"
#endif

@implementation SEGSharedFowardModel
- (instancetype)initWithDictionary:(NSDictionary*)dictionary
{
    self = [super init];
    if (self) {
        _shareContent = @"";
        _time = @"";
        _communityName = @"";
        _shareTitle = @"";
        _objType = @"";
        _praiseCount = @"";
        _shareId = @"";
        _sharePicture = @"";
        _objId = @"";
        _isPraise = @"";
        _channelId = @"";
        _channelName = @"";
        [self setValuesForKeysWithDictionary:dictionary];
        //设置layout
        [self saveLayout];
    }
    return self;
}
+ (instancetype)initWithDictionary:(NSDictionary*)dictionary
{
    return [[self alloc] initWithDictionary:dictionary];
}
- (void)setValue:(id)value forUndefinedKey:(NSString*)key
{}
- (void)setShareContent:(NSString*)shareContent{
    _shareContent = [[SEGUtils ValueToString:shareContent]copy];
}
- (void)setTime:(NSString*)time{
    _time = [[SEGUtils ValueToString:time]copy];
}
- (void)setCommunityName:(NSString*)communityName{
    _communityName = [[SEGUtils ValueToString:communityName]copy];
}
- (void)setShareTitle:(NSString*)shareTitle{
    _shareTitle = [[SEGUtils ValueToString:shareTitle]copy];
}
- (void)setObjType:(NSString*)objType{
    _objType = [[SEGUtils ValueToString:objType]copy];
}
- (void)setPraiseCount:(NSString*)praiseCount{
    _praiseCount = [[SEGUtils ValueToString:praiseCount]copy];
}
- (void)setShareId:(NSString*)shareId{
    _shareId = [[SEGUtils ValueToString:shareId]copy];
}
- (void)setSharePicture:(NSString*)sharePicture{
    _sharePicture = [[SEGUtils ValueToString:sharePicture]copy];
}
- (void)setObjId:(NSString*)objId{
    _objId = [[SEGUtils ValueToString:objId]copy];
}
- (void)setIsPraise:(NSString*)isPraise{
    _isPraise = [[SEGUtils ValueToString:isPraise]copy];
}

- (void)setChannelId:(NSString *)channelId{
    _channelId = [[SEGUtils ValueToString:channelId] copy];
}

- (void)setChannelName:(NSString *)channelName{
    _channelName = [[SEGUtils ValueToString:channelName] copy];
}

- (void)saveLayout
{
    // 控件数据模型创建
    SEGcustomContentViewModel *data = [[SEGcustomContentViewModel alloc] init];
    data.widgetWidth = LYScreenWidth() - kNeighbourTextLeftPadding - 15;//宽度
    data.contentText = _shareContent;
    SEGFocusViewModel *focusDataSource = [[SEGFocusViewModel alloc] init];
    focusDataSource.contentTitle = _shareTitle;
    focusDataSource.image = _sharePicture;
    focusDataSource.channelName = _channelName;
    data.focusDataSource = focusDataSource;
    data.isDetailView = YES;
    _layout = [[SEGcustomContentViewLayout alloc] initWithData:data type:SEGEnumcustomContentViewType_FOCUS];
}
@end
